open(BUFF,"xchr_include.fam");
$i =0;
while($line=<BUFF>)
{
	chomp($line);
	@array = split(" ",$line);
	$hash{$array[1]} = $i++;
}
open(BUFF,"allpopulation.fam");
open(WRB,">allpopulation_xchr.fam");
while($line=<BUFF>)
{
        chomp($line);
        @array = split(" ",$line);
        if(exists($hash{$array[1]}))
	{
		$array1[$hash{$array[1]}] = $line;
	}
}
for($i=0;$i<@array1;$i++)
{
	print WRB $array1[$i]."\n";
}
system("mv allpopulation_xchr.fam xchr_include.fam");	
